#pragma once

#include "head.h"
#include "task.h"

class ReadTask: public Task{
public:
    int fd_;
    ReadTask(int fd): fd_(fd){}

    void work()
    {
        cout << "read_work" << endl;
        int fd = open("/home/wgl/code/cpp/project/terminal_cloud_disk/01/include/net_server.h", O_RDONLY);
        ERR_CHECK(fd, -1, "open");
        
        int ret;
        char buf[1024]{};
        while((ret = read(fd, buf, sizeof(buf) - 1))){
            cout << buf;
            bzero(buf, sizeof(buf));
        }

        close(fd);
    }
};